#include <stdio.h>

#include "variable_middle.h"
char MAC_DATA[16];
s_type     s;

uint8_t  get_device_num = 0, eot_num, show_device_num = 0,  RX_Buffer[2][RX_LEN] = {0},
         send_index, current_page_index = 0, send_tx_time, send_tx_len,hank_out_time;
Ymodemfile get_file;
YmodemPacket  Y_1K_data;
Ymodem128Packet  Y_128_data;
UART_TYPE   receve_order0, uart_data0, uart_data_blue, receve_order_blue, Uart_send_data;
 unsigned short  wait_out_time, uart0_time,  stateflag, stateflag_blue, re_send_order, buzzer_time, buzzer_set_time, send_run_time, get_data_time;
 unsigned short get_name_time, mac_time, off_line_time, receive_count;
const uint32_t Check_data_addr =0X70000;
const uint32_t APP_Flash_page_Count = 112;
const uint32_t Chip_Flash_Max_Size = 0x80000;                           /**< SWM341 系列 Flash 容量上限 512K Bytes */
const uint32_t UserBoot_Addr = 0x00000;                                 /**< UserBoot 加载地址 */
const uint32_t UserBoot_Size = 0x10000;                                 /**< UserBoot 预设大小 <4K 对齐> (可预留多一些, 以便后续有更新 UserBoot 的需求, 暂未预留接口实现) */
const uint32_t UserBoot_Version = 0x20231007;                           /**< UserBoot 程序版本 */
const uint32_t Firmware_Addr = UserBoot_Addr + UserBoot_Size;           /**< APP 加载地址 */
uint32_t write_addr,write_len;
//*******************************************
//bms_main_type       bms_main_data;
//bms_info_type       bms_info_data ;
//bms_version_type    bms_version_data ;
//bms_cell_type       bes_cell_data;;
//dsp_version_type    dsp_version_data;
ble_device_type Device_list[30];
def_ble_device_type def_device, eeprom_def_device;
//*******************************************
const  char GET_MAC[] = {0x54, 0x54, 0x4D, 0x3A, 0x4D, 0x41, 0x43, 0x2D, 0x3F};
const  char BLE_RESET[] = {0x54, 0x54, 0x4D, 0x3A, 0x52, 0x53, 0x54, 0x2D, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4D, 0x52, 0x45, 0x53, 0x45, 0x54};
const  char BLE_ADD[] = {0x54, 0x54, 0x4D, 0x3A, 0x41, 0x44, 0x44, 0x2D};
const  char BLE_PID[] = {0x54, 0x54, 0x4D, 0x3A, 0x50, 0x49, 0x44, 0x2D};
const  char *BLE_SET_NAME = "TTM:REN-";
char BLE_DEF_NAME[] = "BMS-Dsp";

char BLE_GET_NAME[] = "TTM:NAM-?";
char BLE_READ_NAME[BLE_NAME_LEN] = {0,};